﻿using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using System;
using System.IO;
using UnityEditor.SceneManagement;

public class EasyEditor : Editor
{
    [MenuItem("Custom/GotoSetup")]
    public static void GoToSetUp()
    {
        EditorSceneManager.OpenScene(Application.dataPath + "/Scenes/Setup.unity");
        //EditorApplication.OpenScene(Application.dataPath + "/Scenes/UIEditor.unity");
    }
    [MenuItem("Custom/UIEditor")]
    public static void GoToUIEditor()
    {
        EditorSceneManager.OpenScene(Application.dataPath + "/Scenes/UIEditor.unity");
        //EditorApplication.OpenScene(Application.dataPath + "/Scenes/UIEditor.unity");
    }

    //将配置文件放入Resource目录下
    [MenuItem("Custom/ConfigToResources")]
    public static void ConfiguToResoources()
    {

        var srcPath = Application.dataPath + "/../Config/";
        var dstPath = Application.dataPath + "/Resources/Config/";

        Directory.Delete(dstPath, true);
        Directory.CreateDirectory(dstPath);

        foreach (var filePath in Directory.GetFiles(srcPath))
        {

            var fileName = filePath.Substring(filePath.LastIndexOf('/') + 1);
            File.Copy(srcPath + fileName, dstPath + fileName + ".bytes", true);
        }

        //立马刷新
        AssetDatabase.Refresh();
        Debug.Log("配置文件复制完毕");

    }


}
